package com.ningxia.water.service.impl;

import com.ningxia.water.entity.TsApplicantInfo;
import com.ningxia.water.mapper.TsApplicantInfoMapper;
import com.ningxia.water.service.ITsApplicantInfoService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ningxia.water.vo.out.ApplicantInfoVo;
import com.ningxia.water.vo.out.ReportVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author hz
 * @since 2021-05-14
 */
@Service
public class TsApplicantInfoServiceImpl extends ServiceImpl<TsApplicantInfoMapper, TsApplicantInfo> implements ITsApplicantInfoService {

    @Autowired
    private TsApplicantInfoMapper applicantInfoMapper;

    @Override
    public List<ApplicantInfoVo> getApplicantInfo(String applicantName, Integer zoneId, Integer zoneType) {
        List<ApplicantInfoVo> list = applicantInfoMapper.getApplicantInfo(applicantName, zoneId, zoneType);
        return list;
    }

    @Override
    public List<ReportVo> getApplicantStatistical(String type, String currentTime) {
        if (type.equals("year")){
            return applicantInfoMapper.getApplicantStatisticalByYear(currentTime);
        }else if (type.equals("month")){
            return applicantInfoMapper.getApplicantStatisticalByMonth(currentTime);
        }else if (type.equals("day")){
            return applicantInfoMapper.getApplicantStatisticalByDay(currentTime);
        }
        return null;
    }

}
